// Achievement by G3X / GeXeH - Enjoy
// Version 1.0

// Achievement: Get set the material shiny white by another player 3 times.

local Value = achievements.GetValue( "Mr Sheen", "total", 0 )
local Status = false

local function Update()

	if (Value != 3 && !string.find( ( gmod.GetGamemode().Name or "" ), "Zombie Survival") ) then
		// print("Check Started.\n")
		local ply = LocalPlayer()
		local material = ply:GetMaterial()

		if (!ValidEntity( ply )) then return end
		
		if ( (material == "models/shiny") && !SinglePlayer() ) then
			if !Status then
				Status = true
				// print("Player is shiny.\n")
				Value = math.Clamp( Value + 1, 0, 3 )
				achievements.SetValue( "Mr Sheen", "total", Value )
				achievements.Update( "Mr Sheen", Value / 3, Value .. "/3" )
			end
		else
			Status = false
			// print("Player is not shiny.\n")
		end

		// print("Check Ended.\n")
	
	else
		timer.Destroy("Achievement.MrSheen")
	end

end

timer.Create("Achievement.MrSheen", 1, 0, Update)

achievements.Register( "Mr Sheen", "Get set the material shiny white by another player 3 times.", "achievements/mrsheen", Value / 3, Value .. "/3" )